package com.he.architecture.controller;

import com.he.architecture.common.controller.LogicController;
import com.he.architecture.dao.ShopDao;
import com.he.architecture.dto.ResponseResult;
import com.he.architecture.entity.Shop;
import com.he.architecture.service.BusinessService;
import com.he.architecture.service.ShopService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.repository.query.Param;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/shop")
public class ShopController extends LogicController<ShopService, ShopDao, Shop,Long> {
    public ShopController(@Autowired ShopService service){
        super(service);
    }
    @GetMapping("/getShopsByBusiness_Id")
    public ResponseResult getShopsByBusiness_Id(@Param("bus_id") Long bus_id){
        List<Shop> shops=getService().getShopsByBusiness_Id(bus_id);
        Map<String,Object> map=new HashMap<>();
        map.put("shops",shops);
        return new ResponseResult(200,map);
    }
}
